import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

// returns the reservations in the data base

public class SqlTest3
{
	
	  public static void main(String args[]) throws SQLException {
	
		  Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/bedandbreakfast",
					  "root", "");	
		  Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, 
		                                       ResultSet.CONCUR_UPDATABLE);
		  ResultSet uprs = stmt.executeQuery("SELECT P_id, guestName, roomNumber, totalNumberOfGuests, checkIn, checkOut FROM reservation");

		  System.out.println("Reservations Contained in the DATABASE:");
		  System.out.println("");
		  
		  while (uprs.next()) {
		        int P_id = uprs.getInt("P_id");
		        String guestName = uprs.getString("guestName");
		        int roomNumber = uprs.getInt("roomNumber");
		        int totalNumberOfGuests = uprs.getInt("totalNumberOfGuests");
		        String checkIn = uprs.getString("checkIn");
		        String checkOut = uprs.getString("checkOut");
		        System.out.println("Reservation Number: " + P_id + "    Guest Name: " + guestName + "    Room Number: " + roomNumber + "    Total Number of Guests: " + totalNumberOfGuests + "    Check In: " + checkIn + "    Check Out: " + checkOut);
		        
		}



}
}